<template>
  <div class = "pos_content">
    <Search @getCode = "getCode"/>
    <div class="bom_main clearfix">
      <PosDetail :snInfo="snInfo" :spinShow = "spinShow"/>
      <PosBom :snInfo="snInfo" :spinShow = "spinShow"/>
    </div>
  </div>
</template>

<script>
import Search from '../components/search';
import PosDetail from '../components/posDetail';
import PosBom from '../components/posBom';
import myServer from '@/api/index.js';
  export default {
    name: "pos.index"
    ,data(){
      return {
        newCode:''
        ,snInfo:{}
        ,spinShow:false
      }
    }
    ,created(){
      let t = this;
      document.title = '机身号(SN)查询';
      t.$store.commit('setHeaderTitle',document.title);
    }
    ,mounted(){
      let t = this;
    }
    ,methods:{
      getCode(code){
        let t = this;
        t.newCode = code;
        t.getSnInfo();
      }
      ,getSnInfo(){
        let t = this;
        myServer.v(this);
        t.spinShow = true;
        myServer.posInfo.snInfo({
          data:{snNo:t.newCode}
          ,success(data){
            console.log(t.snInfo)
            t.spinShow = false;
          }
        })
      }
    }
    ,components:{
      Search
      ,PosDetail
      ,PosBom
    }
  }
</script>

<style lang="scss" scoped>
  .pos_content{
    .pos_main{
      margin: 0 20px;
    }
  }
</style>